<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>2-03 重新开启路径，样式不覆盖</title>
</head>
<body>
<canvas id="c" width="300" height="300" style="border: 1px solid #ccc;"></canvas>

<script>

  const context = document.getElementById('c')
  const ctx = context.getContext('2d')

  ctx.moveTo(20, 100)
  ctx.lineTo(200, 100)
  ctx.lineWidth = 10
  ctx.strokeStyle = 'pink'
  ctx.stroke()

  ctx.beginPath() // 重新开启一个路径
  ctx.moveTo(20, 120.5)
  ctx.lineTo(200, 120.5)
  ctx.lineWidth = 4
  ctx.strokeStyle = 'red'
  ctx.stroke()

</script>
</body>
</html>